const Sequelize = require("sequelize")
const SequelizeAuto = require('sequelize-auto')
//创建一个新的sequelize实例
const DB = new Sequelize("meiwo","root","root",{
    host:'localhost',
    port:3306,
    dialect:"mysql",
    pool:{
        max:5,//最大连接数
        min:0,
        idle:10000,//如果十秒内没有被使用，释放连接
    },
    // logging:false, //禁用sqeuelize日志输出
    logging:console.log, //禁用sqeuelize日志输出
});
DB
.authenticate()
.then(() => {
    console.log("连接数据库成功")
})
.catch((err) => {
    console.error("数据库连接失败",err)
})
module.exports = DB